package com.lagou.module3hw.hw5;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

/**
 * 玩家类
 */
public class Player {

    private String name;        //玩家姓名
    private ArrayList<String> card = new ArrayList<>();      //玩家的牌

    public Player() {
    }

    public Player(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ArrayList<String> getCard() {
        //返回玩家手中的牌，排序由大到小输出,按比较器指定的循序排序
        Collections.sort(this.card,new ComparatorCard());
        return this.card;
    }

    public void setCard(String card) {
        this.card.add(card);
    }
}
